<!DOCTYPE html>
<html lang="en" ng-app="deepDRapp">
<head>
  <title>
    DEEP DR
  </title>
  <script src="http://cdn.bootcss.com/jquery/3.1.1/jquery.js"></script>
</head>
<body>
<audio id="audiotag1" src="/static/sound/2331.wav" preload="auto"></audio>
<form name="frmKKbj" id="f">
  <input type="text" id='XQDM' name='XQDM' value="201702">
  <input type="text" id='YXDM' name='YXDM' value="03300">
</form>



<table id="ele"></table>

<script type="text/javascript">
    //      function call() {
    //          var http_call = new XMLHttpRequest();
    //          xhttp.onreadystatechange = function () {
    //              if (this.readyState == 4 && this.status == 200) {
    //                  document.getElementById("demo").innerHTML = this.responseText;
    //              }
    //          };
    //          http_call.open("POST", 'www.yjs.sjtu.edu.cn:81/epstar/web/outer/KKBJ_CX/kkbj.jsp', true);
    //          http_call.send();
    //      }
    function call() {
        var form = $('form');
        var fd = form.serialize();
//        console.log(form);
//        console.log(fd);

        $.ajax({
            url: 'http://www.yjs.sjtu.edu.cn:81/epstar/web/outer/KKBJ_CX/kkbj.jsp',
            type: 'POST',
            Origin: 'http://www.yjs.sjtu.edu.cn:81',
            data: fd,
            success: function (result) {
                var e = $(result);
                var table = $('#table_5', e);
                var certainrow = $('TR:contains(机器学习)', table);
                var limit = $('b', certainrow);
                ele = $('#ele');
                ele.empty();
                var limit_number = parseInt(limit.text().slice(2, 4));
                var selected = parseInt($(":nth-child(10)", certainrow).text());
                ele.append(certainrow);
                ele.append(limit_number);
                ele.append("<br>");
                ele.append(selected);
                ele.append("<br>");
                if (selected == limit_number) {
//                    console.log('same');
                    ele.append('same');
                } else {
                    console.log('classes ready');
//                    ele.append('ready');
                    document.getElementById('audiotag1').play();
                }
                ele.append('<br>');
                var d = new Date();
                var n = d.getTime();
                ele.append(d)
            }

        })
    }

    $(document).ready(function () {
        call();
        setInterval(function () {
            call()
        }, 2000);
    });
</script>

</body>
</html>